﻿using TouchSocket.Core;
using TouchSocket.Sockets;

ITcpClient ITcpClient = new TcpClient();

ITcpClient.Setup(new TouchSocketConfig()
    .SetRemoteIPHost("127.0.0.1:502")
    );

ITcpClient.Connecting = (client, e) =>
{
    Console.WriteLine("Connecting...");
    return EasyTask.CompletedTask;
};

ITcpClient.Connected = (client, e) =>
{
    Console.WriteLine("Connected");
    return EasyTask.CompletedTask;
};

Console.ReadKey();
ITcpClient.Connect();
//try
//{
//    ITcpClient.Connect(millisecondsTimeout: 1000);
//}
//catch (Exception ex)
//{
//    Console.WriteLine(ex.Message);
//}
Console.ReadKey();


